GDK W32: Deduplicate reparenting
authorРуслан Ижбулатов <lrn1986@gmail.com>
Mon, 11 Apr 2016 07:07:14 +0000 (07:07 +0000)
committerРуслан Ижбулатов <lrn1986@gmail.com>
Tue, 12 Apr 2016 12:56:11 +0000 (12:56 +0000)
gdk_window_reparent() already changes children list for old and new parent.
Doing so twice results in a circular reference in the list, which can hang
the application later, for example in gtk_window_show().

https://bugzilla.gnome.org/show_bug.cgi?id=764845

gdk/win32/gdkwindow-win32.c

index 3029e46ee37015ca6845cc7955df5461a7952434..c304912a4b57525700d387a68e306ecacfe72b81 100644 (file)
@@ -1662,8 +1662,6 @@ gdk_win32_window_reparent (GdkWindow *window,
                           gint       y)
 {
   GdkScreen *screen;
-  GdkWindow *parent;
-  GdkWindow *old_parent;
   GdkWindowImplWin32 *impl;
   gboolean new_parent_is_root;
   gboolean was_toplevel;
@@ -1679,8 +1677,6 @@ gdk_win32_window_reparent (GdkWindow *window,
   else
      new_parent_is_root = (gdk_screen_get_root_window (screen) == new_parent);
 
-  old_parent = window->parent;
-  parent = new_parent;
   impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
   GDK_NOTE (MISC, g_print ("gdk_win32_window_reparent: %p: %p\n",
@@ -1745,11 +1741,6 @@ gdk_win32_window_reparent (GdkWindow *window,
        }
     }
 
-  if (old_parent)
-    old_parent->children = g_list_remove_link (old_parent->children, &window->children_list_node);
-
-  parent->children = g_list_concat (&window->children_list_node, parent->children);
-
   return FALSE;
 }